@extends('layout.main')

@section('content')

    <div class="alert alert-success" role="alert">
        下面是搜索 "<span style="color: red;font-weight: bold;">{{ $query }}</span>"出现的文章，共{{ $posts->total() }}条
    </div>

    <div class="col-sm-8 blog-main">
        @foreach($posts as $post)
            <div class="blog-post">
                <h2 class="blog-post-title"><a href="/posts/{{$post->id}}">{{ $post->title }}</a></h2>
                <p class="blog-post-meta">{{ $post->created_at->toFormattedDateString() }} by
                    <a href="#">{{ $post->user->name }}</a>
                </p>
                <p>{!! $post->content !!}</p>
                <p class="blog-post-meta">赞 {{ $post->zans_count }} | 评论 {{ $post->comments_count }}</p>
            </div>
        @endforeach

        ​{!! $posts->appends(['query'=>$query])->links()!!}​

    </div><!-- /.blog-main -->

@endsection
